<template>
	<view class="">
		<u-tabs :list="plantlist" @click="plactClick" style="flex:1"></u-tabs>
		<scroll-view scroll-y="true" style="height: calc(100vh  - 96rpx);" @scrolltolower="scrollLower">
			<view>
				<u-cell size="large" :title="item.title" :value="item.content" :label="item.orderInfo.order_no"
					v-for="(item,index) in plantListdata" @click="handleDetail(item.id)"></u-cell>
			</view>
		</scroll-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				status: 0,
				list_row: 10,
				page: 1,
				plantlist: [{
						name: "未处理",
						value: 0
					},
					{
						name: '处理中',
						value: 1
					}, {
						name: '已处理',
						value: 2
					}
				],
				plantListdata: [],
				totalData:0
			}
		},
		methods: {
			handleDetail(id){
				uni.navigateTo({
					url:"/pages/user/custComp/detail?id=" + id
				})
			},
			scrollLower(){
				if(this.totalData!=this.plantListdata.length){
					this.page +1 
					this.getPlantList()
				}
			},
			plactClick(e) {
				console.log(e)
				this.status = e.index
				this.plantListdata = []
				this.getPlantList()
			},
			getPlantList() {
				let self = this;
				let params = {
					status: self.status,
					list_row: self.list_row,
					page: self.page
				}
				self._post('order.complaint/list', params, function(res) {
					if (res.code == 1) {
						self.plantListdata = self.plantListdata.concat(res.data.data)
						self.totalData = res.data.total
					}
				})
			}
		},
		onShow() {
			this.getPlantList()
		}
	}
</script>

<style lang="scss" scoped>
	::v-deep .u-tabs__wrapper__nav__item {
		flex: 1 !important;
	}
	::v-deep .u-cell__value{
		width: 60%;
	}
</style>